﻿<UserControl
    x:Class="WinRTXamlToolkit.Debugging.Views.PropertyEditors.CornerRadiusPropertyEditor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WinRTXamlToolkit.Debugging.Views.PropertyEditors"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="using:WinRTXamlToolkit.Controls"
    xmlns:converters="using:WinRTXamlToolkit.Converters"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="340">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary
                    Source="ms-appx:///WinRTXamlToolkit.Debugging/Themes/SharedResources.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Style
                x:Key="SmallNumericUpDownStyle"
                TargetType="controls:NumericUpDown">
                <Setter
                    Property="Foreground"
                    Value="{StaticResource TextBoxForegroundThemeBrush}" />
                <Setter
                    Property="FontFamily"
                    Value="{StaticResource ContentControlThemeFontFamily}" />
                <Setter
                    Property="FontSize"
                    Value="{StaticResource ControlContentThemeFontSize}" />
                <Setter
                    Property="Template">
                    <Setter.Value>
                        <ControlTemplate
                            TargetType="controls:NumericUpDown">
                            <Border
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                VerticalAlignment="Top">
                                <Border.Resources>
                                    <!-- NumericUpDownButtonStyle -->
                                    <Style
                                        x:Key="NumericUpDownButtonStyle"
                                        TargetType="RepeatButton">
                                        <Setter
                                            Property="Background"
                                            Value="{StaticResource ButtonBackgroundThemeBrush}" />
                                        <Setter
                                            Property="Foreground"
                                            Value="{StaticResource ButtonForegroundThemeBrush}" />
                                        <Setter
                                            Property="BorderBrush"
                                            Value="{StaticResource ButtonBorderThemeBrush}" />
                                        <Setter
                                            Property="BorderThickness"
                                            Value="{StaticResource ButtonBorderThemeThickness}" />
                                        <Setter
                                            Property="Padding"
                                            Value="0,-1,0,0" />
                                        <Setter
                                            Property="HorizontalAlignment"
                                            Value="Left" />
                                        <Setter
                                            Property="VerticalAlignment"
                                            Value="Center" />
                                        <Setter
                                            Property="FontFamily"
                                            Value="Segoe UI Symbol" />
                                        <Setter
                                            Property="FontWeight"
                                            Value="SemiBold" />
                                        <Setter
                                            Property="Width"
                                            Value="32" />
                                        <Setter
                                            Property="Height"
                                            Value="32" />
                                        <Setter
                                            Property="FontSize"
                                            Value="18.667" />
                                        <Setter
                                            Property="MinWidth"
                                            Value="32" />
                                        <Setter
                                            Property="MinHeight"
                                            Value="32" />
                                        <Setter
                                            Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate
                                                    TargetType="RepeatButton">
                                                    <Grid>
                                                        <VisualStateManager.VisualStateGroups>
                                                            <VisualStateGroup
                                                                x:Name="CommonStates">
                                                                <VisualState
                                                                    x:Name="Normal" />
                                                                <VisualState
                                                                    x:Name="PointerOver">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames
                                                                            Storyboard.TargetName="Border"
                                                                            Storyboard.TargetProperty="Background">
                                                                            <DiscreteObjectKeyFrame
                                                                                KeyTime="0"
                                                                                Value="{StaticResource RepeatButtonPointerOverBackgroundThemeBrush}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames
                                                                            Storyboard.TargetName="ContentPresenter"
                                                                            Storyboard.TargetProperty="Foreground">
                                                                            <DiscreteObjectKeyFrame
                                                                                KeyTime="0"
                                                                                Value="{StaticResource RepeatButtonPointerOverForegroundThemeBrush}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </VisualState>
                                                                <VisualState
                                                                    x:Name="Pressed">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames
                                                                            Storyboard.TargetName="Border"
                                                                            Storyboard.TargetProperty="Background">
                                                                            <DiscreteObjectKeyFrame
                                                                                KeyTime="0"
                                                                                Value="{StaticResource RepeatButtonPressedBackgroundThemeBrush}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames
                                                                            Storyboard.TargetName="ContentPresenter"
                                                                            Storyboard.TargetProperty="Foreground">
                                                                            <DiscreteObjectKeyFrame
                                                                                KeyTime="0"
                                                                                Value="{StaticResource RepeatButtonPressedForegroundThemeBrush}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </VisualState>
                                                                <VisualState
                                                                    x:Name="Disabled">
                                                                    <Storyboard>
                                                                        <ObjectAnimationUsingKeyFrames
                                                                            Storyboard.TargetName="Border"
                                                                            Storyboard.TargetProperty="Background">
                                                                            <DiscreteObjectKeyFrame
                                                                                KeyTime="0"
                                                                                Value="{StaticResource RepeatButtonDisabledBackgroundThemeBrush}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames
                                                                            Storyboard.TargetName="Border"
                                                                            Storyboard.TargetProperty="BorderBrush">
                                                                            <DiscreteObjectKeyFrame
                                                                                KeyTime="0"
                                                                                Value="{StaticResource RepeatButtonDisabledBorderThemeBrush}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                        <ObjectAnimationUsingKeyFrames
                                                                            Storyboard.TargetName="ContentPresenter"
                                                                            Storyboard.TargetProperty="Foreground">
                                                                            <DiscreteObjectKeyFrame
                                                                                KeyTime="0"
                                                                                Value="{StaticResource RepeatButtonDisabledForegroundThemeBrush}" />
                                                                        </ObjectAnimationUsingKeyFrames>
                                                                    </Storyboard>
                                                                </VisualState>
                                                            </VisualStateGroup>
                                                            <VisualStateGroup
                                                                x:Name="FocusStates">
                                                                <VisualState
                                                                    x:Name="Focused">
                                                                    <Storyboard>
                                                                        <DoubleAnimation
                                                                            Storyboard.TargetName="FocusVisualWhite"
                                                                            Storyboard.TargetProperty="Opacity"
                                                                            To="1"
                                                                            Duration="0" />
                                                                        <DoubleAnimation
                                                                            Storyboard.TargetName="FocusVisualBlack"
                                                                            Storyboard.TargetProperty="Opacity"
                                                                            To="1"
                                                                            Duration="0" />
                                                                    </Storyboard>
                                                                </VisualState>
                                                                <VisualState
                                                                    x:Name="Unfocused" />
                                                                <VisualState
                                                                    x:Name="PointerFocused" />
                                                            </VisualStateGroup>
                                                        </VisualStateManager.VisualStateGroups>
                                                        <Border
                                                            x:Name="Border"
                                                            Background="{TemplateBinding Background}"
                                                            BorderBrush="{TemplateBinding BorderBrush}"
                                                            BorderThickness="{TemplateBinding BorderThickness}"
                                                            Margin="0">
                                                            <ContentPresenter
                                                                x:Name="ContentPresenter"
                                                                Content="{TemplateBinding Content}"
                                                                ContentTransitions="{TemplateBinding ContentTransitions}"
                                                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                                                Margin="{TemplateBinding Padding}"
                                                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                                        </Border>
                                                        <Rectangle
                                                            x:Name="FocusVisualWhite"
                                                            IsHitTestVisible="False"
                                                            Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
                                                            StrokeEndLineCap="Square"
                                                            StrokeDashArray="1,1"
                                                            Opacity="0"
                                                            StrokeDashOffset="1.5" />
                                                        <Rectangle
                                                            x:Name="FocusVisualBlack"
                                                            IsHitTestVisible="False"
                                                            Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
                                                            StrokeEndLineCap="Square"
                                                            StrokeDashArray="1,1"
                                                            Opacity="0"
                                                            StrokeDashOffset="0.5" />
                                                    </Grid>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>

                                    <!-- DecrementButtonStyle -->
                                    <Style
                                        x:Key="DecrementButtonStyle"
                                        BasedOn="{StaticResource NumericUpDownButtonStyle}"
                                        TargetType="RepeatButton">
                                        <Setter
                                            Property="Content"
                                            Value="➖" />
                                    </Style>

                                    <!-- IncrementButtonStyle -->
                                    <Style
                                        x:Key="IncrementButtonStyle"
                                        BasedOn="{StaticResource NumericUpDownButtonStyle}"
                                        TargetType="RepeatButton">
                                        <Setter
                                            Property="Content"
                                            Value="➕" />
                                    </Style>
                                </Border.Resources>
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup
                                        x:Name="IncrementalButtonStates">
                                        <VisualState
                                            x:Name="IncrementEnabled">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames
                                                    Storyboard.TargetName="PART_IncrementButton"
                                                    Storyboard.TargetProperty="IsEnabled">
                                                    <DiscreteObjectKeyFrame
                                                        KeyTime="0"
                                                        Value="True" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState
                                            x:Name="IncrementDisabled">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames
                                                    Storyboard.TargetName="PART_IncrementButton"
                                                    Storyboard.TargetProperty="IsEnabled">
                                                    <DiscreteObjectKeyFrame
                                                        KeyTime="0"
                                                        Value="False" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup
                                        x:Name="DecrementalButtonStates">
                                        <VisualState
                                            x:Name="DecrementEnabled">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames
                                                    Storyboard.TargetName="PART_DecrementButton"
                                                    Storyboard.TargetProperty="IsEnabled">
                                                    <DiscreteObjectKeyFrame
                                                        KeyTime="0"
                                                        Value="True" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState
                                            x:Name="DecrementDisabled">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames
                                                    Storyboard.TargetName="PART_DecrementButton"
                                                    Storyboard.TargetProperty="IsEnabled">
                                                    <DiscreteObjectKeyFrame
                                                        KeyTime="0"
                                                        Value="False" />
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition
                                            Width="Auto" />
                                        <ColumnDefinition
                                            Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <Grid
                                        Grid.Column="0">
                                        <Rectangle
                                            x:Name="PART_ValueBar"
                                            IsHitTestVisible="False"
                                            Fill="#FFFFFFFF" />
                                        <TextBox
                                            x:Name="PART_ValueTextBox"
                                            FontFamily="{TemplateBinding FontFamily}"
                                            FontSize="{TemplateBinding FontSize}"
                                            Foreground="{TemplateBinding Foreground}"
                                            InputScope="Number"
                                            HorizontalAlignment="Stretch"
                                            IsReadOnly="{TemplateBinding IsReadOnly}"
                                            IsEnabled="{TemplateBinding IsEnabled}"
                                            MinHeight="24" />
                                        <Rectangle
                                            x:Name="PART_DragOverlay"
                                            Fill="Transparent" />
                                    </Grid>
                                    <RepeatButton
                                        Grid.Column="1"
                                        x:Name="PART_DecrementButton"
                                        Margin="8,0,0,0"
                                        Style="{StaticResource DecrementButtonStyle}"
                                        Width="24"
                                        Height="24"
                                        MinWidth="24"
                                        MinHeight="4"
                                        FontSize="14" />
                                    <RepeatButton
                                        Grid.Column="2"
                                        x:Name="PART_IncrementButton"
                                        Margin="8,0,0,0"
                                        Style="{StaticResource IncrementButtonStyle}"
                                        Width="24"
                                        Height="24"
                                        MinWidth="24"
                                        MinHeight="24"
                                        FontSize="14" />
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter
                    Property="HorizontalAlignment"
                    Value="Left" />
                <Setter
                    Property="VerticalAlignment"
                    Value="Top" />
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid
        Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <StackPanel
            Margin="5">
            <TextBlock
                Text="{Binding Name}"
                Foreground="{StaticResource ApplicationForegroundThemeBrush}"
                FontWeight="Bold"
                Margin="0,0,10,0" />
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition
                        Height="3" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition
                        Width="Auto" />
                    <ColumnDefinition />
                    <ColumnDefinition
                        Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Border
                    Width="25"
                    Height="25"
                    Grid.Row="0"
                    Grid.Column="0"
                    BorderThickness="2"
                    BorderBrush="#FF636363">
                    <TextBlock
                        FontFamily="Segoe UI Symbol"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"
                        FontSize="14"
                        Foreground="{StaticResource ApplicationForegroundThemeBrush}"
                        Text="&#x2196;" />
                </Border>
                <Border
                    Width="25"
                    Height="25"
                    Grid.Row="2"
                    Grid.Column="0"
                    BorderThickness="2"
                    BorderBrush="#FF636363">
                    <TextBlock
                        FontFamily="Segoe UI Symbol"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"
                        FontSize="14"
                        Foreground="{StaticResource ApplicationForegroundThemeBrush}"
                        Text="&#x2199;" />
                </Border>
                <Border
                    Width="25"
                    Height="25"
                    Grid.Row="0"
                    Grid.Column="2"
                    BorderThickness="2"
                    BorderBrush="#FF636363">
                    <TextBlock
                        FontFamily="Segoe UI Symbol"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"
                        FontSize="14"
                        Foreground="{StaticResource ApplicationForegroundThemeBrush}"
                        Text="&#x2197;" />
                </Border>
                <Border
                    Width="25"
                    Height="25"
                    Grid.Row="2"
                    Grid.Column="2"
                    BorderThickness="2"
                    BorderBrush="#FF636363">
                    <TextBlock
                        FontFamily="Segoe UI Symbol"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center"
                        FontSize="14"
                        Foreground="{StaticResource ApplicationForegroundThemeBrush}"
                        Text="&#x2198;" />
                </Border>
                <controls:NumericUpDown
                    x:Name="NumericUpDownTopLeft"
                    ValueChanged="OnNumericUpDownValueChanged"
                    Grid.Column="1"
                    Minimum="0"
                    Maximum="1000000"
                    DragSpeed="100"
                    SmallChange="1"
                    Height="25"
                    Margin="5,0,15,0"
                    FontSize="12"
                    Style="{StaticResource SmallNumericUpDownStyle}" />
                <controls:NumericUpDown
                    x:Name="NumericUpDownTopRight"
                    ValueChanged="OnNumericUpDownValueChanged"
                    Grid.Column="3"
                    Minimum="0"
                    Maximum="1000000"
                    DragSpeed="100"
                    SmallChange="1"
                    Height="25"
                    Margin="5,0,0,0"
                    FontSize="12"
                    Style="{StaticResource SmallNumericUpDownStyle}" />
                <controls:NumericUpDown
                    x:Name="NumericUpDownBottomRight"
                    ValueChanged="OnNumericUpDownValueChanged"
                    Grid.Column="3"
                    Grid.Row="2"
                    Minimum="0"
                    Maximum="1000000"
                    DragSpeed="100"
                    SmallChange="1"
                    Height="25"
                    Margin="5,0,0,0"
                    FontSize="12"
                    Style="{StaticResource SmallNumericUpDownStyle}" />
                <controls:NumericUpDown
                    x:Name="NumericUpDownBottomLeft"
                    ValueChanged="OnNumericUpDownValueChanged"
                    Grid.Row="2"
                    Grid.Column="1"
                    Minimum="0"
                    Maximum="1000000"
                    DragSpeed="100"
                    SmallChange="1"
                    Height="25"
                    Margin="5,0,15,0"
                    FontSize="12"
                    Style="{StaticResource SmallNumericUpDownStyle}" />
            </Grid>
            <local:PropertyEditorFooter />
        </StackPanel>
    </Grid>
</UserControl>
